package com.shuyuntu.proposal.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;

import javax.persistence.*;

/**
 * 教师代表
 *
 * @author 厉猛
 * Created by syt005 on 2016/4/13.
 */
@Entity
@Table(name = "delegate")
public class Delegate {
    /**
     * 教工编号
     */
    private String id;

    /**
     * 姓名
     */
    private String name;

    /**
     * 登录密码
     */
    @JsonIgnore
    private String password;

    /**
     * 对应角色
     */
    private Role role;

    /**
     * 对应部门
     */
    private Department department;

    /**
     * 无参构造
     */
    public Delegate() {}

    @Id
    @Column(length = 10)
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Column(nullable = false)
    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Column(length = 28, nullable = false)
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @ManyToOne
    @JoinColumn(name = "role_id", referencedColumnName = "id", nullable = false)
    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    @ManyToOne
    @JoinColumn(name = "department_id", referencedColumnName = "id")
    public Department getDepartment() {
        return department;
    }

    public void setDepartment(Department department) {
        this.department = department;
    }
}
